// 发送消息 向某位女生发送消息

// name: 
// onFulfilled:成功
//onRejected: 失败

function sendMessage(name,onFulfilled,onRejected) {
  //模拟
  console.log(`${name}发送信息来了`)
  console.log('等待回复。。。。。')
  // 模拟 回复需要一段时间
  setTimeout(() => {
      //模拟10% 几率成功
      if(Math.random() <= 0.1){
          onFulfilled('成功了')
      }else{
        onRejected('失败了')
      }
  }, 1000);
}

sendMessage('张三',(reply)=>{
    console.log(reply)    
},
(reply)=>{
  console.log(reply)  
  sendMessage('张三', (reply)=>{
    console.log(reply)    
},
(reply)=>{
  console.log(reply)    
  // 失败里面一直掉用
})
}
)

// 这样就是回调地狱